using FriendStar.Code;
using FriendStar.Domain.Entity.VBaseData;
using FriendStar.Domain.IRepository.VBaseData;
using FriendStar.Repository.VBaseData;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;

namespace FriendStar.Application.VBaseData
{
    public class V_ZSJ_12_GH_SuProductionApp
    {
        private IV_ZSJ_12_GH_SuProductionRepository service = new V_ZSJ_12_GH_SuProductionRepository();

        public List<V_ZSJ_12_GH_SuProductionEntity> GetList()
        {
            return service.IQueryable().ToList();
        }
        public List<V_ZSJ_12_GH_SuProductionEntity> GetGH_SuProductions(string useUnit, string fProductionNO)
        {
            var expression = ExtLinq.True<V_ZSJ_12_GH_SuProductionEntity>();
            if (!string.IsNullOrEmpty(useUnit))
            {
                expression = expression.And(t => t.UseUnit == useUnit);
            }
            if (!string.IsNullOrEmpty(fProductionNO))
            {
                expression = expression.And(t => t.FProductionNO.Contains(fProductionNO));
            }
            return service.IQueryable(expression).Select(p => new V_ZSJ_12_GH_SuProductionEntity { FProCompanyNO = p.FProCompanyNO, FProCompanyName = p.FProCompanyName }).OrderBy(p => p.FProCompanyNO).ToList();
        }
    }
}
